<?php
/*
  $Id: epdq_success.php 
*/

	require('includes/application_top.php');
	
	$epdq_oid = $_REQUEST['oid'];

	$err = "NotFound=$epdq_oid";
	$selstr = "SELECT * FROM ".TABLE_EPQD." WHERE oid='$epdq_oid'";
	$check_query = tep_db_query($selstr);
	$count = tep_db_num_rows($check_query);
	if ($count == 1)
	{
		// Now get the status
		$status = tep_db_fetch_array($check_query);
		$err = $status['transaction_status'];
		if ($status['transaction_status'] == "Success")
		{
			// We don't want or need to keep successes
			$selstr = "DELETE FROM ".TABLE_EPQD," WHERE oid='$epdq_oid'";
			$check_query = tep_db_query($selstr);
		    tep_redirect(tep_href_link(FILENAME_CHECKOUT_PROCESS));
			exit;
		}
	}
    tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, 'err='.$err));

?>
